<template>
	<view>
		<view class="header">
			<image class="img" src="/static/images/设置.png" mode="" @click="infor"></image>
			<image class="title" src="/static/avatar_default.89845f4e.png" mode=""></image>
			<view class="text">
				user123
			</view>
		</view>
		<view class="MyDing">
			<view class="MyDing-top">
				<view class="M-top-title">
					我的订单
				</view>
				<view class="M-top-value" @click="getdetail(0)">
					全部订单
				</view>
				<view class="arrowHead">

				</view>
			</view>
			<view class="MyDing-bottom">
				<view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']">
					<view class="cu-item" v-for="(item,index) in cuIconList" :key="index" @click="getdetail(index+1)">
						<view>
							<image :src="item.url" mode="" style="width: 24px; height: 24px;"></image>
							<!-- <view class="cu-tag badge" v-if="item.badge>0">
								<block>{{item.badge}}</block>
							</view> -->
						</view>
						<text class="Order-text">{{item.name}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="coupon">
			<view class="coupon-top">
				<view class="M-top-title">
					我的优惠券
				</view>
				<view class="M-top-value" @click="getcoupon(0)">
					全部优惠券
				</view>
				<view class="arrowHead">

				</view>
			</view>
			<view class="coupon-bottom">
				<view class="cu-list grid" :class="['col-' + couponCol,couponBorder?'':'no-border']">
					<view class="cu-item" v-for="(item,index) in couponList" :key="index" @click="getcoupon(index)">
						<view>
							<image :src="item.url" mode="" style="width: 30px; height: 30px;"></image>
							<!-- <view class="cu-tag badge" v-if="item.badge>0">
								<block>{{item.badge}}</block>
							</view> -->
						</view>
						<text class="Order-text">{{item.name}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="foot">
			<view class="cu-list menu" :class="[menuBorder?'sm-border':'',menuCard?'card-menu margin-top':'']">
				<view class="cu-item" :class="menuArrow?'arrow':''" v-for="(item,index) in footList" :key="index"
					@click="jumpAdd(index)">
					<view class="content">
						<image :src="item.url" class="png" mode="aspectFit"></image>
						<text style="color:#333;">{{item.name}}</text>
					</view>
					<view class="arrowHead">

					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuBorder: false,
				menuArrow: false,
				menuCard: false,
				gridCol: 4,
				gridBorder: false,
				cuIconList: [{
					url: '/static/images/toPay.png',
					badge: 0,
					name: '待支付'
				}, {
					url: '/static/images/toTake.png',
					badge: 1,
					name: '待发货'
				}, {
					url: '/static/images/toDelivery.png',
					badge: 0,
					name: '待收货'
				}, {
					url: '/static/images/toComment.png',
					badge: 0,
					name: '已完成'
				}],
				couponCol: 3,
				couponBorder: false,
				couponList: [{
					url: '/static/images/toUse.png',
					badge: 0,
					name: '待使用'
				}, {
					url: '/static/images/used.png',
					badge: 1,
					name: '已使用'
				}, {
					url: '/static/images/past.png',
					badge: 0,
					name: '过期关闭'
				}],
				footList: [{
					url: '/static/images/Love.png',
					name: '我的收藏',
				}, {
					url: '/static/images/address.png',
					name: '收货地址',
				}, {
					url: '/static/images/serve.png',
					name: '服务中心',
				}]
			}
		},
		onShow() {
			let token = uni.getStorageSync('Authorization');
			console.log(this.$route.path);
			if (this.$route.path === '/pages/mine/mine' && token == '') {
				uni.redirectTo({
					url: '/pages/login/login'
				});
			}
		},
		methods: {
			getcoupon(val) {
				uni.navigateTo({
					url: '/pages/coupon/coupon?sts=' + val
				})
			},
			getdetail(val) {
				uni.navigateTo({
					url: '/pages/orderList/orderList?sts=' + val
				})
			},
			infor() {
				uni.navigateTo({
					url: '/pages/information/information'
				})
			},
			jumpAdd(index) {
				if (index == 0) {
					uni.navigateTo({
						url: '/pages/collect/collect'
					})
				} else if (index == 1) {
					uni.navigateTo({
						url: '/pages/address/address'
					})
				} else {
					uni.navigateTo({
						url: '/pages/serveCenter/serveCenter'
					})
				}
			}
		}
	}
</script>

<style>
	@import url('mine.css');
</style>